import { Column, Entity, Index, PrimaryGeneratedColumn } from "typeorm";

@Index("user_id", ["userId"], {})
@Entity("charge_card_log", { schema: "cabinet" })
export class ChargeCardLog {
  @PrimaryGeneratedColumn({ type: "int", name: "id", unsigned: true })
  id: number;

  @Column("int", { name: "user_id", unsigned: true, default: () => "'0'" })
  userId: number;

  @Column("int", { name: "card_id", unsigned: true, default: () => "'0'" })
  cardId: number;

  @Column("int", { name: "relation_id", unsigned: true, default: () => "'0'" })
  relationId: number;

  @Column("decimal", {
    name: "amount",
    precision: 6,
    scale: 2,
    default: () => "'0.00'",
  })
  amount: string;

  @Column("decimal", {
    name: "reward_amount",
    precision: 6,
    scale: 2,
    default: () => "'0.00'",
  })
  rewardAmount: string;

  @Column("decimal", {
    name: "before_amount",
    precision: 6,
    scale: 2,
    default: () => "'0.00'",
  })
  beforeAmount: string;

  @Column("decimal", {
    name: "before_reward_amount",
    precision: 6,
    scale: 2,
    default: () => "'0.00'",
  })
  beforeRewardAmount: string;

  @Column("decimal", {
    name: "after_amount",
    precision: 6,
    scale: 2,
    default: () => "'0.00'",
  })
  afterAmount: string;

  @Column("decimal", {
    name: "after_reward_amount",
    precision: 6,
    scale: 2,
    default: () => "'0.00'",
  })
  afterRewardAmount: string;

  @Column("tinyint", {
    name: "type",
    comment: "1:充值，2：充电，3：充电结束退款",
    unsigned: true,
    default: () => "'0'",
  })
  type: number;

  @Column("int", {
    name: "create_time",
    comment: "创建时间",
    unsigned: true,
    default: () => "'0'",
  })
  createTime: number;
}
